package com.ruoyi.data.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.data.domain.HomeColConfig;
import com.ruoyi.data.domain.vo.HomeColConfigVo;
import com.ruoyi.data.domain.vo.IndexStatisticsVo;
import com.ruoyi.data.service.IGetDataService;
import com.ruoyi.data.service.IIndexService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 首页统计
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/home")
public class IndexController {

    private final IIndexService iIndexService;


    @GetMapping("/getIndexStatistics")
    public R<List<IndexStatisticsVo>> getIndexStatistics() {
        return R.ok(iIndexService.getIndexStatistics());
    }

    @PostMapping("/setPageJson")
    public R<Void> setPageJson(@RequestBody HomeColConfigVo homeColConfigVo) {
        return R.ok(iIndexService.setPageJson(homeColConfigVo));
    }

    @PostMapping("/getPageJson")
    public R<String> getPageJson(@RequestBody HomeColConfig req) {
        return R.ok("ok",iIndexService.getPageJson(req));
    }

}
